
Partial Class ReadComments
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim comment As New CommentObj

        If Not IsNothing(Request.QueryString("CommentID")) Then
            Dim status As Boolean
            'Making it the opposite of what it was
            If CType(Request.QueryString("Status"), Boolean) Then status = False Else status = True
            comment.ChangeCommentApproval(CInt(Request.QueryString("CommentID")), status)
        End If

        If HttpContext.Current.Profile.UserName = "admin" Then
            DataList1.DataSource = comment.GetCommentsForArticle(Request.QueryString("ArticleID"))
        Else
            DataList1.DataSource = comment.GetApprovedCommentsForArticle(Request.QueryString("ArticleID"))
        End If
        DataList1.DataKeyField = "CommentID"
        DataList1.DataBind()

    End Sub
End Class
